package com.spring2.pojo;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.Data;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
@Data
@Scope("singleton")  // 多例类
public class Person {
    private String name;
    private Integer age;
    private String sex;
    public Person(){
        System.out.println("person....");
    }
    @PostConstruct
    public void init(){
        System.out.println("init");
    }
    @PreDestroy
    public void destroy(){
        System.out.println("destroy");
    }
}

